<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue.js</title>
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="vue-app">
        <h1>Computed 计算属性</h1>
        <button @click="a++">Add to A</button>
        <button @click="b++">Add to B</button>
        <p>A - {{a}}</p>
        <p>B - {{b}}</p>
        <!-- 弊端：两个函数都会调用 性能差 -->
        <!-- <p>Age + A = {{addToA()}}</p> -->
        <!-- <p>Age + B = {{addToB()}}</p> -->

        <!-- 计算属性不需要加() -->
        <p>Age + A = {{addToA}}</p>
        <p>Age + B = {{addToB}}</p>
    </div>
    <script src="app.js"></script>
</body>
</html>